package com.kwz.common.ui;

import javax.swing.JButton;

import com.kwz.common.IComparable;
import com.kwz.common.IContext;
import com.kwz.common.designpatterns.factory.BadContextException;
import com.kwz.common.ui.events.IUiEventDefinition;

/**
 * <p>
 * 				Classe encapsulant un bouton JButton
 * </p> 
 *
 * @author Ccr
 */
public class UiJButton extends UiAbstractButton implements IUiJButton {

    // Statiques
    public static final IUiEventDefinition[] EVENTS_DEFS = new IUiEventDefinition[]{
            UI.CHAIN(UiAbstractButton.class)
    };
    
    /**
     * @throws BadContextException
     */
    public UiJButton() throws BadContextException {
        this((IContext)null);
    }
    
    public UiJButton(JButton button) throws BadContextException {
        this(createContextFromComponent(null, button));
    }

    /**
     * @param id
     * @param button
     * @throws BadContextException
     */
    public UiJButton(IComparable id, JButton button) throws BadContextException {
        this(createContextFromComponent(id, button));
    }

    /**
     * @param context
     * @throws BadContextException
     */
    public UiJButton(IContext context) throws BadContextException {
        super(context);
    }
    
    // ----------------------------------- IUiJButton -------------------------
    /* (non-Javadoc)
     * @see com.kwz.common.ui.IUiJButton#getJButton()
     */
    public JButton getJButton() {
        return (JButton)getComponent();
    }

}
